<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    姓名：<input type="text" ref="userInput" @mouseenter="showText" @mouseleave="hideText">

</div>
</body>
</html>
<script src="../../js/vue.js"></script>
<script>
    new Vue({
        el: "#app",
        data: {},
        methods: {
            showText() {
                console.log('我进来了');
                this.$refs.userInput.value = '李泽民';
            },
            hideText() {
                console.log('又走了');
                this.$refs.userInput.value = '';
            },
        },
    });
</script>

